package cn.zd.thumbbackend.controller;

import cn.zd.thumbbackend.common.BaseResponse;
import cn.zd.thumbbackend.common.ResultUtils;
import cn.zd.thumbbackend.constant.UserConstant;
import cn.zd.thumbbackend.model.entity.User;
import cn.zd.thumbbackend.service.UserService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {
    
    @Resource
    private UserService userService;
    
    @GetMapping("/login")
    public BaseResponse<User> login(long userId, HttpServletRequest request) {
        return ResultUtils.success(userService.login(userId, request));
    }
    
    @GetMapping("/get/login")
    public BaseResponse<User> getLoginUser(HttpServletRequest request) {
        return ResultUtils.success(userService.getLoginUser(request));
    }
    
    
}
